<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script type="text/javascript" src="../js/vue.js"></script>
</head>

<body>
    <div id="root">
        <h2>当前的n值是:<span v-text="n"></span></h2>
        <h2>放大10倍后的n值是:<span v-big="n"></span></h2>
    
        
        <button @click="n++">点我n+1</button>
        <br/>

        <input type="text" v-fbind="n">
    </div>


    <script type="text/javascript">
        new Vue({
            el: '#root',
            data: {
                n: 1
            },
            directives:{
                big(element,binding){
                    console.log('big',this)
                    element.innerText = binding.value * 10;
                    console.log(element,binding.value);

                },
                fbind:{
                    bind(element,binding){
                        element.value = binding.value
                        console.log('bind')
                    },
                    inserted(element,binding){
                        element.focus()
                        console.log('inserted')
                    },
                    update(element,binding){
                        element.value = binding.value
                        console.log('update')
                    }
                }
            }

        })


    </script>
</body>

</html>